package com.resourcestore.dao;

import java.util.List;

import com.resourcestore.dao.BaseDao;
import com.resourcestore.model.Roles;
import com.resourcestore.model.Users;
import com.resourcestore.utils.tag.Pagination;

public class UsersDao extends BaseDao {

	public List<Users> selectUsers() {
		List<Users> list = this.queryForList("selectUsers");
		return list;
	}

	public List<Users> selectUsersPage(Users users, Pagination pagination) {
		List<Users> list = this.queryForPage("selectUsersPage", users,
				pagination);
		return list;
	}

	public int queryUsersNum(Users users) {
		return this.queryNum("selectUsersCount", users);
	}

	public Users loginAdmin(Users users) {
		return (Users) this.queryForObject("loginAdmin", users);
	}

	public Users selectUsersByUserName(Users users) {
		return (Users) this.queryForObject("selectUsersByUserName", users);
	}

	public void updatePasswordByUserName(Users users) {
		this.update("updatePasswordByUserName", users);
	}

	public Users selectUsersById(Users users) {
		return (Users) this.queryForObject("selectUsersById", users);
	}

	public void insertUsers(Users users) {
		this.insert("insertUsers", users);
	}

	public int insertAndReturnPK(Users users) {
		int userId = this.insertAndReturnPK("insertUsers", users);
		return userId;
	}

	public void updateUsers(Users users) {
		this.update("updateUsers", users);
	}

	public void updateUsersHasPassword(Users users) {
		this.update("updateUsersHasPassword", users);
	}

	public void deleteUsers(Users users) {
		this.delete("deleteUsers", users);
	}

	public void deleteMoreUsers(Users users) {
		this.delete("deleteMoreUsers", users);
	}

}
